<?php
session_start();
include_once 'Controller/UserController.php';
include_once 'DAO/User.php';

if (isset($_POST['email'], $_POST['pwd']))
{
		
	$email = $_POST['email'];
	$pwd = $_POST['pwd'];
	
	$email = htmlentities($email);
	$pwd = htmlentities($pwd);
	
	//test champs
	if(filter_var($email, FILTER_VALIDATE_EMAIL) || strlen($pwd)< 6)
		return -1;

	
	$u = new User();
	$u->email = $email;
	$u->password = $pwd;
	
	
	$ret = $u->saveUserinBDD();
	
	echo($ret);
}
else
{
	echo "Params manquants !";
}

?>